package com.htsk.city.services.core.dao;


import com.htsk.city.services.core.domain.SysUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * (SysUser)表数据库访问层
 *
 * @author makejava
 * @since 2024-09-25 18:13:08
 */
@Repository
public interface SysUserDao extends JpaRepository<SysUser,Integer>, JpaSpecificationExecutor<SysUser> {
    @Query(value = "SELECT * from sys_user WHERE del_flag=0 and (username=?1 or mobile=?2)",nativeQuery = true)
    SysUser findByUsernameOrMobile(String username,String mobile);

    SysUser findByUsernameAndDelFlag(String username,int delFlag);

    SysUser findByMobileAndDelFlag(String mobile,int delFlag);

    Page<SysUser> findByNicknameIsLikeAndDelFlag(String nickname,int delFlag, Pageable pageable);
}

